﻿function tabClick(ele) {
    if (!$(ele).hasClass("tabUtype_active")) {
        $(".tabUtype_active").removeClass("tabUtype_active");
        $(ele).addClass("tabUtype_active");
        if ($(".login_Area_bk_left")[0]) {
            $(".login_Area_bk_left").addClass("login_Area_bk_right");
            $(".login_Area_bk_left").removeClass("login_Area_bk_left");
        }
        else if ($(".login_Area_bk_right")[0]) {
            $(".login_Area_bk_right").addClass("login_Area_bk_left");
            $(".login_Area_bk_right").removeClass("login_Area_bk_right");
        }
    }
}
function iptfocus() {
    if ($("#tip").hasClass("info")) {
        $("#tip").removeClass("info");
        $("#tip").text("");
    }
}
function login() {
    //获取用户填写的帐号、密码提交到Controller
    //var flag = $(".tabUtype_active").attr("flag");
    var flag = "1";// 张洪志修改,强制系统登录,修改日期:2014/01/20
    var loginName = $.trim($("#txt_UName input").val());
    var loginPwd = $.trim($("#txt_UPwd input").val());

    if (loginName == "") {
        $("#tip").addClass("info");
        $("#tip").text("请输入用户名！");
        return;
    }
    if (loginPwd == "") {
        $("#tip").addClass("info");
        $("#tip").text("请输入密码！");
        return;
    }
    var _p;
    if (flag == "0") {
        _p = loginPwd;
    }
    else
        _p = $.md5(loginPwd);

    //var key = "[{'col_loginname':'" + loginName + "','col_password':'" + $.md5(loginPwd) + "','flag':'" + flag + "'}]"; //$.md5(loginPwd)
    //debugger;
    $.ajax({
        url: "/Home/UserLogin",
        type: "post",
        data: {
            col_loginname: loginName,
            col_password: _p,
            flag: flag
            //key: key
        },
        success: function (text) {
            if (arguments[2].responseText == "")
                location.href = "/Home/Index";
            else
                $("#tip").addClass("info");
            $("#tip").text(text);
        },
        error: function (jqXHR, textStatus, errorThrown) {
            alert(jqXHR.responseText);
        }
    });

}